express = require 'express'
restrict = require __basename + '/middlewares/restrict'

module.exports = app = express()

# User Accounts API
users = require './users'
app.post '/users/register', users.registerUser
app.post '/users/login', users.login
app.post '/users/loginbyname', users.loginByName
app.get '/users/userid', users.getUserById
app.get '/users/email', restrict(), users.getUserByEmail
app.get '/users/nickname', users.getUserByNickname
app.get '/users/mobile', users.getUserByMobile
app.post '/users/updateuser', users.updateUserBasicInfo
app.post '/users/updatecartid', users.updateCartId
app.post '/users/changepassword', users.changePassword
app.post '/users/resetpassword', users.resetPassword
app.get '/users/checkname', users.checkName
app.get '/users/checkemail', users.checkEmail
app.get '/users/isoffline', users.isOfflineUser
app.get '/users/checkvipvaild', users.checkVipValid
app.post '/users/createofflineactivationcode', users.createOfflineActivationCode
app.get '/users/checkofflineactivationcode', users.checkOfflineActivationCode
app.post '/users/activateuser', users.activateUser
app.post '/users/createandsendofflineactivationcode', users.createAndSendOfflineActivationCode
app.post '/users/syncuser', users.syncUser
app.get '/users/getusersbyrecid', users.getUsersByRecId
app.post '/users/getusersbyuserids', users.getUsersByUserIds
# app.post '/users/createcustomer', users.createCustomer
app.post '/users/updatecustomer', users.updateCustomer
app.post '/users/createcustomeraccount', users.createCustomerAccount
app.get '/users/getchildrenbyparentid', users.getChildrenByParentId
app.post '/users/insertchild', users.insertChild
app.post '/users/updatechild', users.updateChild